(function (fruit, util) {
    /**
     * @class fruit.converter
     */
    fruit.converter = {
        _converterMap: {
            inverted: {
                convert: function (value) {
                    return !value;
                },
                convertBack: function (value) {
                    return !value;
                }
            },
            boolean: {
                convert: function (value) {
                    return !!value;
                },
                convertBack: function (value) {
                    return !!value;
                }
            }
        },
        /**
         * register a converter
         * @param {String}name
         * @param {Function}convert
         * @param {Function}convertBack
         */
        register: function (name, convert, convertBack) {
            this._converterMap[name] = {
                convert: convert,
                convertBack: convertBack
            }
        },
        /**
         * return a certain converter
         * @param {String}name
         * @returns {Function}
         */
        resolve: function (name) {
            return this._converterMap[name];
        }
    }
})(fruit, fruit.util);